package org.tbjd.client.factories;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.tbjd.client.beans.Project;

public class ProjectFactory {

	public static List<Project> getInstances(int n) {
		List<Project> projects = new ArrayList<Project>();
		Project project = null;
		for (int i = 0; i < n; i++) {
			project = new Project();
			project.setId(i);
			project.setName("Name" + i);
			if (i % 2 == 0) {
				project.setProgress(4+i);
				project.setStarred(false);
				project.setPriority(false);
				project.setStatus("running");
			} else if (i % 3 == 0){
				project.setProgress(15+i);
				project.setStarred(false);
				project.setPriority(true);
				project.setStatus("pending");
			} else if (i % 5 == 0){
				project.setProgress(20+i);
				project.setStarred(true);
				project.setPriority(false);
				project.setStatus("stopped");
			} else if (i % 7 == 0){
				project.setProgress(100);
				project.setStarred(true);
				project.setPriority(true);
				project.setStatus("finished");
			} else{
				project.setProgress(i);
				project.setStarred(true);
				project.setPriority(false);
				project.setStatus("running");
			}
			project.setBeginDate(new Date());
			project.setEndDate(new Date(new Date().getTime() + 30000000));

			projects.add(project);

		}

		return projects;
	}

}
